package com.kingmed.kmss.admin.modules.ums.controller;

import com.kingmed.kmss.admin.modules.ums.model.UmsHrEmployee;
import com.kingmed.kmss.admin.modules.ums.service.UmsHrEmployeeService;
import com.kingmed.kmss.common.vo.CommonResponse;
import com.kingmed.kmss.common.vo.CommonResponseHelper;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * EHR员工表(数据中台接口) 前端控制器
 * </p>
 *
 * @author WYL
 * @since 2022-12-29
 */
@RestController
@RequestMapping("/ums/hr/employee")
@Api(tags = "ums EHR员工表(数据中台接口)")
public class UmsHrEmployeeController {

    @Autowired
    private UmsHrEmployeeService umsHrEmployeeService;

    @ApiOperation("批量新增")
    @PostMapping(value = "/saveBatch")
    public CommonResponse<Integer> saveBatch(@RequestBody List<UmsHrEmployee> data) {
        return CommonResponseHelper.success(umsHrEmployeeService.saveBatchData(data));
    }

    @ApiOperation("HR用户数据触发job")
    @PostMapping(value = "/refreshHrUserList")
    public CommonResponse<Integer> refreshHRUserList() {
        return CommonResponseHelper.success(umsHrEmployeeService.refreshHRUserList());
    }

}
